package com.mhc.suzuki.constant;

/**
 * 顾客类型
 */
public enum CustomerTypeEnum {

    //购车人
    BUYER(1, "购车人"),
    COMMONBUYER(2, "共同购车人"),
    SPONSOR(3, "担保人");

    private Integer code;
    private String name;

    CustomerTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getName() {
        return this.name;
    }

    public static CustomerTypeEnum getCustomerTypeEnum(Integer code) {
        for (CustomerTypeEnum customerTypeEnum : CustomerTypeEnum.values()) {
            if (customerTypeEnum.code.equals(code)) {
                return customerTypeEnum;
            }
        }
        //没有对应的类型，默认主贷人
        return CustomerTypeEnum.BUYER;
    }

}
